/**
 * Qilin-web统一路由守卫封装
 * @author Qilin
 * @description 全局项目关于路由跳转的统一拦截处理
 * @createDate 2025-01-20
 * @lastUpdateDate 2025-01-20
 */

import router from "@/router/index.js";
import Qilin from "qilin-utils";


router.beforeEach(async (to,from)=>{
    const token = Qilin.Storage.getValueSessionStorage("token"); //获取token
    if(token){
        if(to.path === "/login"){
            return {path:"/"};
        }else{
            return true;
        };
    }else{
        if(to.path === "/login"){
            return true;
        }else{
            return {path:"/login"};
        };
    };
});
